#include <iostream>
using namespace std;
	int sum;
	int a, b, c;
	int p1, p2, p3;
int main()
{
	int n;
	
	cin >> n;
	for(int i=1; i<=n; i++)
	{
		cin >> a >> b >> c;
		p1 += a;
		p2 += b;
		p3 += c;
	}
	sum = p1 + p2 +p3;
	cout << p1 << " " << p2 << " " << p3 << " " << sum << " " <<endl;
	return 0;
}
